package com.cheryl.springailearn.config;

import com.cheryl.springailearn.functions.LocationWeatherFunction;
import com.cheryl.springailearn.functions.RecruitServiceFunction;
import org.springframework.ai.chat.client.ChatClient;
import org.springframework.ai.embedding.Embedding;
import org.springframework.ai.embedding.EmbeddingModel;
import org.springframework.ai.vectorstore.SimpleVectorStore;
import org.springframework.ai.vectorstore.VectorStore;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Description;

import java.util.function.Function;

@Configuration
public class AIConfig {

    @Bean
    public ChatClient chatClient(ChatClient.Builder builder) {
        return builder.defaultSystem("你是考拉教育的一名老师，你精通Java开发，你的名字叫考拉AI。").build();
    }

    @Bean
    @Description("某某地方天气怎么样")
    public Function<LocationWeatherFunction.Request, LocationWeatherFunction.Response> locationWeatherFunction(){
        return new LocationWeatherFunction();
    }
    @Bean
    @Description("某某是否有资格面试")
    public Function<RecruitServiceFunction.Request, RecruitServiceFunction.Response> recruitServiceFunction(){
        return new RecruitServiceFunction();
    }

    @Bean
    public VectorStore  createVectorStore(EmbeddingModel model){
        return new SimpleVectorStore(model);
    }

}
